package com.mxl.order.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mxl.common.domain.Result;
import com.mxl.order.entity.Orders;
import com.mxl.order.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author mxl
 * @since 2024-06-11
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService iOrderService;

    @GetMapping("/selAllOrder")
    public Result selAllOrder(){
        return Result.success(iOrderService.list());
    }
    @GetMapping("/selOrderByUserId")
    public List<Orders> selOrderByUserId(@RequestParam("userId") Integer id){
        List<Orders> users = iOrderService.list(
                new QueryWrapper<Orders>().eq("user_id", id));
        return users;
    }



}
